/**
 * Copyright (c) 2010 icer He <icerhe@gmail.com>
 */
package me.linkcn.ydtxl.client.util;

import java.lang.reflect.Field;

import android.content.DialogInterface;

/**
 * @author icer.He
 *
 */
public class Util {
	/**
	 * 点击后不关闭Dialog
	 * @param dialog
	 */
	public static void keepDialog(DialogInterface dialog) {
		try {
			Field field = dialog.getClass().getSuperclass().getDeclaredField("mShowing");
			field.setAccessible(true);
			field.set(dialog, false);
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
	/**
	 * 点击后关闭Dialog
	 * @param dialog
	 */
	public static void dismissDialog(DialogInterface dialog){
		try {
			Field field = dialog.getClass().getSuperclass().getDeclaredField("mShowing");
			field.setAccessible(true);
			field.set(dialog, true);
		} catch (Exception e) {
			e.printStackTrace();
		} 
	}
}
